Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tarjan-graph

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tarjan-graph

[![Build Status](https://travis-ci.org/tmont/tarjan-graph.png)](https://travis-ci.org/tmont/tarjan-graph) [![NPM version](https://img.shields.io/npm/v/tarjan-graph.svg)](https://www.npmjs.com/package/tarjan-graph)

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is tarjan-graph?

The tarjan-graph npm package is a JavaScript library that implements Tarjan's algorithm to find strongly connected components in a directed graph. This is useful in various applications such as analyzing networks, optimizing paths, and detecting cycles in complex systems.

What are tarjan-graph's main functionalities?

Finding Strongly Connected Components

This feature allows you to find and list all strongly connected components in a directed graph. A strongly connected component (SCC) is a subset of the graph where every vertex is reachable from every other vertex in the same subset.

const TarjanGraph = require('tarjan-graph');
const graph = new TarjanGraph();
graph.add('A', ['B']);
graph.add('B', ['C']);
graph.add('C', ['A']);
const scc = graph.getStronglyConnectedComponents();
console.log(scc);

Cycle Detection

This feature checks if the directed graph contains any cycles. A cycle exists when there is a path from a node back to itself through directed edges.

const TarjanGraph = require('tarjan-graph');
const graph = new TarjanGraph();
graph.add('X', ['Y']);
graph.add('Y', ['Z']);
graph.add('Z', ['X']);
const hasCycle = graph.hasCycle();
console.log(hasCycle);

Other packages similar to tarjan-graph

FAQs

Package last updated on 09 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc